package main

import (
	"clean/usecase/io/pb"
	"context"
	"fmt"
	"github.com/smallnest/rpcx/client"
	"github.com/smallnest/rpcx/protocol"
	"time"
)

func main() {
	d := client.NewPeer2PeerDiscovery("tcp@127.0.0.1:8081", "")
	xclient := client.NewXClient("Serve", client.Failfast, client.RandomSelect, d, client.Option{
		Retries:        3,
		ConnectTimeout: 10 * time.Second,
		SerializeType:  protocol.ProtoBuffer,
		CompressType:   protocol.None,
	})
	in := &pb.Input{
		Msg: &pb.Input_InputHello{
			InputHello: &pb.InputHello{
				Name: "aa",
			},
		},
	}

	out := &pb.Output{}
	err := xclient.Call(context.Background(), "Serve", in, out)
	if err != nil {
		// todo
	}
	fmt.Println(out)
}
